import "../css/service.scss"
import '../css/common/header.scss'
import '../css/common/footer.scss'

if (module.hot) { module.hot.accept() } // 实现热更新

setTimeout(()=>{
    console.log('specialTopic');
}, 1000);

$(function(){
    $(".tab").click(function(){
        $('.tab').removeClass('active');
        $(this).addClass('active');
        $('.right-show li').hide();
        $('.right-show li').eq($(this).index()).show();
    });

    var beforeClick = localStorage.getItem('beforeClick');
    $('.submit').click(function(){
        var clickTime = new Date().getTime(),
            errType = $("[name='errType']:radio:checked").val(),
            textarea = $('textarea').val(),
            contactInfo = $('.contact-info').val() || null,
            device = $('.device').val() || null ;

        if(beforeClick){
            var interval = clickTime - beforeClick ;
            if(interval < 60*1000){
                alert("您的反馈频率过快！请在"+ (60 - parseInt(interval/1000)) +"s后再次提交！");
                return;
            }
        }
        if(!errType){
            alert("请选择反馈类型！");
            return;
        }
        if(!textarea){
            alert("请输入反馈的问题！");
            return;
        }
        alert("您反馈的问题我们会尽快处理！");
        // todo ajax
        //回调中 清空input;

        localStorage.setItem('beforeClick',clickTime);
        $("[name='errType']:radio:checked").prop("checked",false);
        $('textarea').val('');
        $('.device').val('');
    })
});